#{extends 'organization.html' /} #{set title: 'Mark Idea as Duplicate' /}
<h1 align="center">Mark Duplicate</h1>
<p align="center">
<a href="@{Browse.viewIdea(idea.id)}">Back again to the idea!</a>
</p>
#{if idea == null}
<h2>Idea doesn't even exist! Still want to mark it? <br>Invalid
	markAsDuplicate Request. Specified Idea was not found on our database.</h2>
#{/if}

#{elseif !authorized}
<h2>Ooops! You do not seem to be a trusted agent that can mark an idea as duplicate! Smells like conspiracy!</h2> 
#{/elseif}
#{else}
<div id="mark-duplicate">

<h2 align="center">You are currently reporting "${idea.title}" as being a duplicate idea.<br> This will be reported to the organizer.</h2>
<h3 align="center">Idea Content:</h3>
<h3 align="center" style="font-style: italic;">${idea.content}</h3>
<h3>${idea.topic.ideas.size() - 1 ?: 'No'} other idea(s) are available under the same topic.</h3>

<form action="@{Browse.addDuplicateMark(idea.id)}" method="post" >
#{list items:idea.topic.ideas, as:'candidateIdea'}
#{if candidateIdea != idea}
#{if wasFound.get(candidateIdea)}
<input type="checkbox" name="dummies" value='${candidateIdea.id}' disabled="disabled" checked="checked" readonly="readonly">
#{/if}
#{else}
<input type="checkbox" name="ids" value='${candidateIdea.id}' >
#{/else}
<a href="@{Browse.viewIdea(candidateIdea.id)}">${candidateIdea.title}</a>
#{if idea.duplicateIdeas != null && idea.duplicateIdeas.contains(candidateIdea)}
<span class="meta-data">Mark Accepted!</span>
#{/if}
<br />
#{/if}
#{/list}
<br />
#{if idea.topic.ideas.size() > 1}
<input type = "submit" value="Choose as Duplicates" id="priority_submit"/>
#{/if}
</form>

</div>

#{/else}

